<template>
    <el-row :gutter="20">
      <el-col :span="10" :offset="6" style="padding:50px"
        ><div class="grid-content bg-purple">
             <div>
            <h2>用户登录</h2>
            <el-form
              label-width="80px"
              class="demo-ruleForm"
              size="mini"
              style="width: 480px"
            >
              <el-form-item label="手机号" prop="pass">
                <el-input type="password" autocomplete="off"></el-input>
              </el-form-item>
              <el-form-item label="密码" prop="checkPass">
                <el-input type="password" autocomplete="off"></el-input>
              </el-form-item>

              <el-form-item>
                <el-button type="primary">登录</el-button>
                <el-button>重置</el-button>
              </el-form-item>
            </el-form>
          </div>
            </div
      ></el-col>
    </el-row>
</template>

<script>

import cookie from "js-cookie";
export default {
  layout: "sign",
  data() {
    return {
      user: {
        mobile: "",
        password: "",
      },
      loginInfo: {},
    };
  },
  methods: {
    //   submitLogin(){
    //         loginApi.submitLogin(this.user).then(response => {
    //           if(response.data.success){

    //             //把token存在cookie中、也可以放在localStorage中
    //             cookie.set('edu_token', response.data.data.token, { domain: 'localhost' })
    //             //登录成功根据token获取用户信息
    //             loginApi.getLoginInfo().then(response => {

    //               this.loginInfo = response.data.data.userInfo
    //               alert(this.loginInfo)
    //               //将用户信息记录cookie
    //               cookie.set('edu_ucenter', this.loginInfo, { domain: 'localhost' })
    //               //跳转页面
    //               window.location.href = "/";
    //             })
    //           }
    //         })
    //   },
    checkPhone(rule, value, callback) {
      //debugger
      if (!/^1[39578]\d{9}$/.test(value)) {
        return callback(new Error("手机号码格式不正确"));
      }
      return callback();
    },
  },
};
</script>

